import '../../utils/color_util/color_util.dart';
import '../../utils/style_util/style_util.dart';
import '../text_widget/text_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

/// @className : text_dialog_widget
/// @date 2022/07/26 14:32
/// @author : xiaohai
/// @description : 普通文本对话框

class TextDialogWidget extends StatefulWidget {

  TextDialogWidget({Key? key, required this.contentStr, this.canceEvent})
      : super(key: key);
  /// 内容
  String? contentStr;
  /// 取消点击事件
  Function()? canceEvent;

  @override
  _ActionBottomSheetState createState() => _ActionBottomSheetState();
}

class _ActionBottomSheetState extends State<TextDialogWidget> {
  @override
  Widget build(BuildContext context) {
    return Container(
      width: 590.w,
      height: 450.w,
      // constraints: BoxConstraints(
      //   minHeight: 400.w,
      //   maxHeight: 824.w
      // ),
      decoration: BoxDecoration(
        color: ColorsUtil.hexColor(0x3F3B52, alpha: 0.96),
        borderRadius: BorderRadius.circular(32.w),
      ),
      child: Column(
        children: [
          //SizedBox(height: 16.w),
          Row(
            mainAxisAlignment: MainAxisAlignment.end,
            children: [
              GestureDetector(
                onTap: () {
                  //取消
                  widget.canceEvent!();
                  Navigator.pop(context);
                },
                child: Container(
                  //decoration: BoxDecoration(color: Colors.red),
                  padding: EdgeInsets.all(8.w),
                  child: Image.asset("assets/images/common_close.png",
                        width: 48.w,
                        height: 48.w)
                ),
              )
            ],
          ),
          Container(
              padding: EdgeInsets.symmetric(horizontal: 32.w),
              child:textWidget("玩法", TS_FFFFFF_40_W5)
          ),
          SizedBox(height: 20.w),

          Expanded(child: Container(
              padding: EdgeInsets.symmetric(horizontal: 32.w),
              //decoration: BoxDecoration(color: Colors.red),
              child: MediaQuery.removePadding(
                removeTop: true,
                removeBottom: true,
                context: context,
                child: ListView(
                  shrinkWrap: true,
                  children: [
                    textWidget(widget.contentStr!, TS_FFFFFF_28_W4_64)
                  ],
                ),
              ))),
          SizedBox(height: 48.w),
        ],
      ),
    );
  }
}
